package com.qf.controller;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qf.mapper.UserMapper;
import com.qf.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/*
 *@Description:
 *@author:刘哥
 *@Date:86180 2022/9/19 19:20
 */
@RestController
public class Controller {
    private UserMapper userMapper;

    @Autowired
    public void setUserMapper(UserMapper userMapper) {
        this.userMapper = userMapper;
    }

    @GetMapping("/find")
    public PageInfo<User> findAll(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);//开启分页
        List<User> userList = userMapper.selectList(null);
        PageInfo pageInfo=new PageInfo();
        pageInfo.setList(userList);//封装分页对象
        return pageInfo;
    }
}
